﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Road3App.ViewModels;

namespace Road3App.Views.UserControls.EditControls
{
    /// <summary>
    /// Interaction logic for AddConnectorUC.xaml
    /// </summary>
    public partial class AddConnectorUC : UserControl
    {
        private AddConnectorViewModel _viewModel;

        public AddConnectorUC()
        {
            InitializeComponent();

            this.DataContextChanged += AddConnectorUC_DataContextChanged;
        }

        void AddConnectorUC_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            _viewModel = this.DataContext as AddConnectorViewModel;
            grid.LayoutTransform = new RotateTransform(
                _viewModel.CrossroadVM.RotationAngle,
                grid.ActualWidth / 2,
                grid.ActualHeight / 2);
        }

        private void RemoveButton_Click(object sender, RoutedEventArgs e)
        {
            _viewModel.RemoveCellFromSequence();
        }
    }
}
